#include <stdio.h>
#include <string.h>
#include <iostream.h>

	long	line[66];
	long	count;
	long	c,s;

long	least()
{
	long	i,j;

	for (i=1;i<=s;i++)
		for (j=1;j<=s;j++)
				if (line[j]>line[j+i])
					return 0;
				else 
				if (line[j]<line[j+i])
					break;
	for (i=s+s+1;i>s;i--)
		for (j=1;j<=s;j++)
			if (line[j]>line[i-j])
				return 0;
			else
			if (line[j]<line[i-j])
				break;
	return 1;
}

long	print()
{
	long	i;
	for (i=1;i<=s;i++)
		printf("%ld",line[i]);
	printf("\n");
	return 0;
}

long	search(long step)
{
	long	i;
	if (step>s)
	{
		if (least()) 
		{
			count++;
			//debug
			//print();
			//debug
		}
		return 0;
	}
	for (i=1;i<=c;i++)
	{
		line[step]=line[step+s]=i;
		search(step+1);
	}
	return 0;
}

main()
{
	scanf("%ld%ld",&c,&s);
	while (s)
	{
		count=0;
		search(1);
		printf("%ld\n",count);
		scanf("%ld%ld",&c,&s);
	}
	return 0;
}

